//! 用户模块
const express = require('express');
//!引入数据库连接池
const pool = require('../pool');
//!  1.创建路由器
const router = express.Router();
//!  2.响应
//! 用户注册
router.put('/',(req,res,next)=>{
    //!得到数据对象body
    let obj = req.body;
    //!执行sql语句
    pool.query('update cook_books set rate=replace(rate,"]",?) where  bid=?',[obj.rate,obj.bid],(err,result)=>{
        if(err) {
            //!处理错误
            next(err);
            return;
        }
        res.send({code:200,msg:'插入成功'});
        console.log(obj);
    });
});
//! 3.导出路由器
module.exports = router;




